package com.bonc.apicreator.dao;


import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.transaction.annotation.Transactional;

import com.bonc.apicreator.entity.RestApiRequest;


/**
 * ApiRequest的dao层接口
 *
 * @author gaopengyu
 * @version 2016年8月5日
 * @see ApiRequestDao
 * @since
 */
@Transactional
public interface ApiRequestDao extends JpaRepository<RestApiRequest, Long> {

    /**
     * Description: 查询所属该api的全部请求
     * 
     * @param apiId
     * @return List<RestApiRequest>
     * @see
     */
    List<RestApiRequest> findByApiIdOrderByDataTypeDesc(Long apiId);

    /**
     * Description: 重名校验
     * 
     * @param apiId
     * @param code
     * @return RestApiRequest
     * @see
     */
    RestApiRequest findByApiIdAndCode(Long apiId, String code);

    /**
     * 查询dataType为pageNum的参数
     * Description: 
     * 
     *@param apiId
     *@param page
     *@return RestApiResponse
     *
     * @see
     */
    RestApiRequest findByApiIdAndDataType(Long apiId, String page);

}
